#!/bin/bash

# 构建脚本 - 使用国内源的开发环境Docker镜像

echo "🚀 开始构建开发环境Docker镜像..."

# 设置镜像名称和标签
IMAGE_NAME="ubuntu-dev-env"
TAG="latest"

# 构建镜像
echo "📦 构建镜像: ${IMAGE_NAME}:${TAG}"
sudo docker build -t ${IMAGE_NAME}:${TAG} .

if [ $? -eq 0 ]; then
    echo "✅ 镜像构建成功！"
    echo ""
    echo "🎯 使用方式："
    echo "   docker run -it ${IMAGE_NAME}:${TAG}"
    echo ""
    echo "📋 包含的开发环境："
    echo "   • C/C++ (gcc, clang, cmake, gdb, valgrind)"
    echo "   • Python 3.12 + pip (清华源)"
    echo "   • Node.js 20.x + npm/yarn/pnpm (淘宝源)"
    echo "   • Java 21 + Maven/Gradle (阿里云源)"
    echo "   • Go 1.22.5 (七牛源)"
    echo "   • Rust (中科大源)"
    echo "   • Claude Code (@anthropic-ai/claude-code)"
    echo ""
    echo "💡 提示：所有包管理器都已配置国内镜像源，加速下载"
else
    echo "❌ 镜像构建失败！"
    exit 1
fi
